package queries;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;


import entitys.Customer;
import enums.Result;

public class ChangeRefferPermissionQuery {

	public static Object exe(Customer entity, Connection conn) {
		//UPDATE `ccrm`.`customer` SET `permit`='0' WHERE `id`='1';
		Statement stmt;
		int permit;
		if(entity.getPermit())
			permit=1;
		else
			permit=0;
		try {
			stmt = conn.createStatement();
			stmt.executeUpdate("UPDATE `ccrm`.`customer` SET `permit`='"+permit+"' WHERE `id`='"+entity.getId()+"';");
			return Result.OK;
		
		} catch (SQLException e) {	return Result.ERROR;}
	}

}
